home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Tool Chest / Development Kits / MPW etc. / MPW-PR / Interfaces&Libraries / Interfaces / AIncludes / MachineExceptions.a < prev   
Encoding:
Text File  |  1998-06-17  |  7.0 KB  |  216 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        MachineExceptions.a
  3. ;
  4. ;    Contains:    Processor Exception Handling Interfaces.
  5. ;
  6. ;    Version:    Technology:    Mac OS 8
  7. ;                Release:    Universal Interfaces 3.1 for AltiVec
  8. ;
  9. ;    Copyright:    © 1993-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__MACHINEEXCEPTIONS__') = 'UNDEFINED' THEN
  19. __MACHINEEXCEPTIONS__ SET 1
  20.  
  21.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  22.     include 'MacTypes.a'
  23.     ENDIF
  24.  
  25. ;  Some basic declarations used throughout the kernel 
  26.  
  27.  
  28.     IF TARGET_OS_MAC THEN
  29. ;  Machine Dependent types for PowerPC: 
  30. MachineInformationPowerPC RECORD 0
  31. CTR                         ds        UnsignedWide    ; offset: $0 (0)
  32. LR                         ds        UnsignedWide    ; offset: $8 (8)
  33. PC                         ds        UnsignedWide    ; offset: $10 (16)
  34. CR                         ds.l    1                ; offset: $18 (24)
  35. XER                         ds.l    1                ; offset: $1C (28)
  36. MSR                         ds.l    1                ; offset: $20 (32)
  37. MQ                         ds.l    1                ; offset: $24 (36)
  38. ExceptKind                 ds.l    1                ; offset: $28 (40)
  39. DSISR                     ds.l    1                ; offset: $2C (44)
  40. DAR                         ds        UnsignedWide    ; offset: $30 (48)
  41. Reserved                 ds        UnsignedWide    ; offset: $38 (56)
  42. sizeof                     EQU *                    ; size:   $40 (64)
  43.                         ENDR
  44. RegisterInformationPowerPC RECORD 0
  45. R0                         ds        UnsignedWide    ; offset: $0 (0)
  46. R1                         ds        UnsignedWide    ; offset: $8 (8)
  47. R2                         ds        UnsignedWide    ; offset: $10 (16)
  48. R3                         ds        UnsignedWide    ; offset: $18 (24)
  49. R4                         ds        UnsignedWide    ; offset: $20 (32)
  50. R5                         ds        UnsignedWide    ; offset: $28 (40)
  51. R6                         ds        UnsignedWide    ; offset: $30 (48)
  52. R7                         ds        UnsignedWide    ; offset: $38 (56)
  53. R8                         ds        UnsignedWide    ; offset: $40 (64)
  54. R9                         ds        UnsignedWide    ; offset: $48 (72)
  55. R10                         ds        UnsignedWide    ; offset: $50 (80)
  56. R11                         ds        UnsignedWide    ; offset: $58 (88)
  57. R12                         ds        UnsignedWide    ; offset: $60 (96)
  58. R13                         ds        UnsignedWide    ; offset: $68 (104)
  59. R14                         ds        UnsignedWide    ; offset: $70 (112)
  60. R15                         ds        UnsignedWide    ; offset: $78 (120)
  61. R16                         ds        UnsignedWide    ; offset: $80 (128)
  62. R17                         ds        UnsignedWide    ; offset: $88 (136)
  63. R18                         ds        UnsignedWide    ; offset: $90 (144)
  64. R19                         ds        UnsignedWide    ; offset: $98 (152)
  65. R20                         ds        UnsignedWide    ; offset: $A0 (160)
  66. R21                         ds        UnsignedWide    ; offset: $A8 (168)
  67. R22                         ds        UnsignedWide    ; offset: $B0 (176)
  68. R23                         ds        UnsignedWide    ; offset: $B8 (184)
  69. R24                         ds        UnsignedWide    ; offset: $C0 (192)
  70. R25                         ds        UnsignedWide    ; offset: $C8 (200)
  71. R26                         ds        UnsignedWide    ; offset: $D0 (208)
  72. R27                         ds        UnsignedWide    ; offset: $D8 (216)
  73. R28                         ds        UnsignedWide    ; offset: $E0 (224)
  74. R29                         ds        UnsignedWide    ; offset: $E8 (232)
  75. R30                         ds        UnsignedWide    ; offset: $F0 (240)
  76. R31                         ds        UnsignedWide    ; offset: $F8 (248)
  77. sizeof                     EQU *                    ; size:   $100 (256)
  78.                         ENDR
  79. FPUInformationPowerPC    RECORD 0
  80. Registers                 ds.b    32 * UnsignedWide.sizeof ; offset: $0 (0)
  81. FPSCR                     ds.l    1                ; offset: $100 (256)
  82. Reserved                 ds.l    1                ; offset: $104 (260)
  83. sizeof                     EQU *                    ; size:   $108 (264)
  84.                         ENDR
  85. Vector128                RECORD 0
  86. l                         ds.l    4                ; offset: $0 (0)
  87.                          ORG 0
  88. s                         ds.w    8                ; offset: $0 (0)
  89.                          ORG 0
  90. c                         ds.b    16                ; offset: $0 (0)
  91. sizeof                     EQU *                    ; size:   $10 (16)
  92.                         ENDR
  93. VectorInformationPowerPC RECORD 0
  94. Registers                 ds.b    32 * Vector128.sizeof ; offset: $0 (0)
  95. VSCR                     ds        Vector128        ; offset: $200 (512)
  96. VRsave                     ds.l    1                ; offset: $210 (528)
  97. sizeof                     EQU *                    ; size:   $214 (532)
  98.                         ENDR
  99. ;  Exception related declarations 
  100.  
  101. kWriteReference                    EQU        0
  102. kReadReference                    EQU        1
  103. kFetchReference                    EQU        2
  104. writeReference                    EQU        0                    ; Obsolete name
  105. readReference                    EQU        1                    ; Obsolete name
  106. fetchReference                    EQU        2                    ; Obsolete name
  107. ; typedef unsigned long                 MemoryReferenceKind
  108.  
  109. MemoryExceptionInformation RECORD 0
  110. theArea                     ds.l    1                ; offset: $0 (0)
  111. theAddress                 ds.l    1                ; offset: $4 (4)
  112. theError                 ds.l    1                ; offset: $8 (8)
  113. theReference             ds.l    1                ; offset: $C (12)
  114. sizeof                     EQU *                    ; size:   $10 (16)
  115.                         ENDR
  116.  
  117. kUnknownException                EQU        0
  118. kIllegalInstructionException    EQU        1
  119. kTrapException                    EQU        2
  120. kAccessException                EQU        3
  121. kUnmappedMemoryException        EQU        4
  122. kExcludedMemoryException        EQU        5
  123. kReadOnlyMemoryException        EQU        6
  124. kUnresolvablePageFaultException    EQU        7
  125. kPrivilegeViolationException    EQU        8
  126. kTraceException                    EQU        9
  127. kInstructionBreakpointException    EQU        10
  128. kDataBreakpointException        EQU        11
  129. kIntegerException                EQU        12
  130. kFloatingPointException            EQU        13
  131. kStackOverflowException            EQU        14
  132. kTaskTerminationException        EQU        15
  133. kTaskCreationException            EQU        16
  134.     IF OLDROUTINENAMES THEN
  135.  
  136. unknownException                EQU        0                    ; Obsolete name
  137. illegalInstructionException        EQU        1                    ; Obsolete name
  138. trapException                    EQU        2                    ; Obsolete name
  139. accessException                    EQU        3                    ; Obsolete name
  140. unmappedMemoryException            EQU        4                    ; Obsolete name
  141. excludedMemoryException            EQU        5                    ; Obsolete name
  142. readOnlyMemoryException            EQU        6                    ; Obsolete name
  143. unresolvablePageFaultException    EQU        7                    ; Obsolete name
  144. privilegeViolationException        EQU        8                    ; Obsolete name
  145. traceException                    EQU        9                    ; Obsolete name
  146. instructionBreakpointException    EQU        10                    ; Obsolete name
  147. dataBreakpointException            EQU        11                    ; Obsolete name
  148. integerException                EQU        12                    ; Obsolete name
  149. floatingPointException            EQU        13                    ; Obsolete name
  150. stackOverflowException            EQU        14                    ; Obsolete name
  151. terminationException            EQU        15                    ; Obsolete name
  152. kTerminationException            EQU        15                    ; Obsolete name
  153.     ENDIF    ; OLDROUTINENAMES
  154. ; typedef unsigned long                 ExceptionKind
  155.  
  156. ExceptionInfo            RECORD 0
  157. memoryInfo                 ds.l    1                ; offset: $0 (0)
  158. sizeof                     EQU *                    ; size:   $4 (4)
  159.                         ENDR
  160. ExceptionInformationPowerPC RECORD 0
  161. theKind                     ds.l    1                ; offset: $0 (0)
  162. machineState             ds.l    1                ; offset: $4 (4)
  163. registerImage             ds.l    1                ; offset: $8 (8)
  164. FPUImage                 ds.l    1                ; offset: $C (12)
  165. info                     ds        ExceptionInfo    ; offset: $10 (16)
  166. vectorImage                 ds.l    1                ; offset: $14 (20)
  167. sizeof                     EQU *                    ; size:   $18 (24)
  168.                         ENDR
  169. ExceptionInformation    RECORD 0
  170. f                         ds        ExceptionInformationPowerPC
  171. sizeof                     EQU *                    ; size:   $18 (24)
  172.                         ENDR
  173.  
  174.  
  175. MachineInformation        RECORD 0
  176. f                         ds        MachineInformationPowerPC
  177. sizeof                     EQU *                    ; size:   $40 (64)
  178.                         ENDR
  179.  
  180.  
  181. RegisterInformation        RECORD 0
  182. f                         ds        RegisterInformationPowerPC
  183. sizeof                     EQU *                    ; size:   $100 (256)
  184.                         ENDR
  185.  
  186.  
  187. FPUInformation            RECORD 0
  188. f                         ds        FPUInformationPowerPC
  189. sizeof                     EQU *                    ; size:   $108 (264)
  190.                         ENDR
  191.  
  192.  
  193. VectorInformation        RECORD 0
  194. f                         ds        VectorInformationPowerPC
  195. sizeof                     EQU *                    ; size:   $214 (532)
  196.                         ENDR
  197.  
  198.  
  199. ;  
  200. ;    Note:    An ExceptionHandler is NOT a UniversalProcPtr.
  201. ;            It must be a PowerPC function pointer with NO routine descriptor. 
  202. ;
  203.  
  204. ;  Routine for installing per-process exception handlers 
  205. ;
  206. ; pascal ExceptionHandler InstallExceptionHandler(ExceptionHandler theHandler)
  207. ;
  208.     IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  209.         IMPORT_CFM_FUNCTION InstallExceptionHandler
  210.     ENDIF
  211.  
  212.     ENDIF    ; TARGET_OS_MAC
  213.  
  214.     ENDIF ; __MACHINEEXCEPTIONS__ 
  215.  
  216.